<template>
  <div>
    <div class="tab">
      <div class="back" @click="handleBack">返回</div>
      <div class="title">阅读</div>
    </div>

    <div class="content">
        <img :src="list.imgSrc" class="logo">
        <div class="hd-det">
            <div class="hd-det-title">
                <img :src="list.avatar" alt="">
                <span>{{list.author}}</span>
            </div>
            <div class="hd-det-n">
                <h2>{{list.title}}</h2>
                <img src="../../assets/icon/collection.png" alt="">
                <img src="../../assets/icon/share.png" alt="">
            </div>
            <div class="detail">
                {{list.detail}}
            </div>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  methods:{
      handleBack(){
          this.$router.back()
      }
  },
  mounted() {
    var { id } = this.$route.query;
    this.$http(`http://47.108.197.28:4000/api/articleDetail?id=${id}`).then(
      (res) => {
        this.list = res.data.res[0];
      }
    );
  },
};
</script>

<style scoped>
.tab {
  position: relative;
  text-align: center;
  line-height: 80px;
  height: 80px;
  background-color: rgb(83, 120, 134);
  color: #fff;
}
.back{
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.title {
  font-size: 36px;
}
.logo{
    width: 100%;
}
.hd-det{
    padding: 20px 30px;
    box-sizing: border-box;
}
.hd-det-title{
    color: #333;
    text-indent: 20px;
    font-size: 32px;
    display: flex;
    align-items: center;
}
.hd-det-title img{
    width: 100px;
    height: 100px;
}
.hd-det-n{
    position: relative;
    height: 200px;
    color: #333;
    border-bottom: 1px solid #aaa;
}
.hd-det-n img{
    width: 100px;
    height: 100px;
    position: absolute;
    bottom: -50px;
    right: 0;
}
.hd-det-n img:nth-child(2){
    right: 120px;
}
.detail{
    margin-top: 50px;
    font-size: 14px;
    color: #666;
    letter-spacing: 2px;
}
</style>